# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2024/3/17
desc: 
sample: 
"""


def fun():
    pass


# 弱类型，动态 面向对象
# 封装 属性 定义 方法
class Message():
    # 构造方法
    def __init__(self, email, content, addr) -> None:
        self.email = email
        self.content = content
        self.addr = addr

    def send(self):
        print(self.email, self.content, self.addr)


msg2 = Message('2323@126.com', 'test', 'dfafaf@qq.com')
msg2.send()


# 模版定义
class Person:
    country = "中国"  # 全局 只会创建一次

    def __init__(self, name, age):
        print("create Person ")
        self.name = name
        self.age = age

    def __str__(self) -> str:
        return f'this {self.name} {self.age}'

    # 私有的
    def __marry(self):
        print(self.name, self.age, '花轿')

    @property  # 方法转变属性
    def send(self):
        return "123"

    @staticmethod  # 静态方法并不是真正意义上的类方法，它只是一个被放到类里的函数而已
    def show():
        pass

    @classmethod  # 类方法 一些框架里面有用
    def get_info(cls):
        pass


class Stu(Person):
    def marry(self):
        print("111")


# stu =Stu()
# 实例
print(Stu.country)
Stu.show()

stu = Stu('zhangsan', 20)  # 计算机 开辟了一个内存空间
print(stu)
print(stu.__dict__)
stu.marry()
print(stu.country)
stu.show()
stu.send

stu2 = Person('李四', 21)
stu2.__marry()
print(stu2.name)
print(stu2.country)
